﻿@using LanDBom.Models
@using LanDBom.Resources
@{
    ViewBag.Title = "AddGS";
    Layout = "~/Views/Shared/_Genertals.cshtml";
}
<style>
    #JX_tfoot th {
        width: 61px
    }

    #JX_tfoot tr th input {
        width: 100%
    }

    .YCFile {
        display: none;
        background-color: #fff;
        width: 350px;
        height: 150px;
        position: absolute;
        left: 22%;
        top: 40%;
    }

    .YCFile12 {
        display: none;
        background-color: #fff;
        width: 81%;
        position: absolute;
        left: 10%;
        top: 25%;
    }

    .YANds {
        display: flex;
        align-items: center;
        justify-content: space-between;
        background-color: #0866a563;
        border-radius: 8px;
        margin: 3px 4px;
        padding: 2px 10px;
    }

    .SHnacs {
        display: flex;
        width: 96%;
        height: 65%;
        align-items: flex-start;
        justify-content: space-between;
        background-color: #cecece;
        border-radius: 8px;
        margin: 3px 4px;
        padding: 2px 10px;
    }

    select, input[style="text"], input[style="email"], input[style="number"] {
        width: 100px;
    }
</style>
<h2>@Resource.String269</h2>

<div id="wid">
    @using (Html.BeginForm("AddGS", "Material", FormMethod.Post))
    {
        <fieldset class="boun">
            <legend class="len">@Resource.String155</legend>
            <div class="row">
                <p class="col">
                    @Html.Label(Resource.String270)
                    @Html.TextBox("shen")
                </p>
                <p class="col">
                    @Html.Label(Resource.String271)
                    @Html.TextBox("ming")
                </p>
                <p class="col">
                    @Html.Label(Resource.String272)
                    @Html.TextBox("shi")
                </p>
                <p class="col-2">
                    <input type="submit" value="@Resource.String155" class=" btn-secondary btn-sm" />
                </p>
            </div>
        </fieldset>
    }
    <div>
        <input type="button" name="tianjia" value="@Resource.String274" class="btn" />
        <input type="button" name="juxu" id="btn_bc" value="共 @ViewBag.count 供应商待提交 " class="btn" />

        <input type="button" name="juxu" id="btn_ls" value="共 @ViewBag.count2 供应商待评价 " class="btn" />
        <input type="button" name="juxu" id="btn_chuan" value="批量上传" class="btn" />
        <input type="button" name="juxu" id="btn_ERP" value="ERP供应商同步" class="btn" />
    </div>
    <div style="display:none" id="cs_sc_sx"></div>
    <div style="height:500px">
        <table class="tab table ">
            <thead class="thead-light">
                <tr style="text-align-last:center;">
                    <th scope="col" style="width:50px">@Resource.String275</th>
                    <th scope="col" id="Dan" style="width:100px">@Resource.String276</th>
                    <th scope="col" style="width:300px">@Resource.String277</th>
                    <th scope="col">@Resource.String278</th>
                    <th scope="col">@Resource.String279</th>
                    <th scope="col">@Resource.String280</th>
                    <th scope="col">@Resource.String281</th>
                    <th scope="col">@Resource.String791</th>
                    <th scope="col">@Resource.String792</th>
                    <th scope="col">@Resource.String282</th>
                    <th scope="col"></th>
                    <th scope="col"></th>
                </tr>
            </thead>
            <tbody id="BUtain" style="height:460px;overflow-y:auto;">
                @if (true)
                {
                    var hunddd = 1;
                    foreach (Providers item in Model)
                    {
                        <tr>
                            <td style="width:50px">@hunddd</td>
                            <td style="display:none">@item.PR_ID</td>
                            <td style="width:100px;text-align:right">@item.PR_bian</td>
                            <td style="width:300px">@item.PR_name</td>
                            <td>@item.PR_di</td>
                            <td>@item.PR_lian</td>
                            <td>@item.PR_you</td>
                            <td>@item.PR_bei</td>
                            <td>@item.PR_Lei1</td>
                            <td>@item.PR_Lei2</td>
                            <td><span id="gys_zr"><a>@Resource.String360</a></span></td>
                            <td><span id="gys_jx">机械数据</span></td>
                            <td><span id="Xiu_cli" class="DEL_c DEL_c_Y">@Resource.String358</span>|<span id="Del_Cli" class="DEL_c DEL_c_D">@Resource.String359</span></td>
                        </tr>
                        hunddd++;
                    }
                }

            </tbody>
        </table>
        @*@Html.ActionLink("Bom", "BOMView", new { Controller = "Detailed", Action = "BOMView" }, new { @class = "nav=link" })*@
    </div>
</div>
@*查看供应商的机型*@
@*设备名称	品牌	所属工序	最大加工尺寸	最小加工尺寸	产能/小时	标准人力	最厚加工尺寸	最薄加工尺寸	最小开槽高度	最大开槽高度	最大印刷尺寸*@
<div class="CenterDiv2" style="text-align-last: center; display: none; border: 1px black solid; background-color: lightgray" id="div3">
    <table style="width:100%;overflow:scroll">
        <thead style="width:100%;overflow:scroll">
            <tr>
                <th scope="col">@Resource.String779</th>
                <th scope="col">@Resource.String780</th>
                <th scope="col">@Resource.String781</th>
                <th scope="col">@Resource.String782</th>
                <th scope="col">@Resource.String783</th>
                <th scope="col">@Resource.String784</th>
                <th scope="col">@Resource.String785</th>
                <th scope="col">@Resource.String786</th>
                <th scope="col">@Resource.String787</th>
                <th scope="col">@Resource.String788</th>
                <th scope="col">@Resource.String789</th>
                <th scope="col">@Resource.String790</th>
                <th scope="col">@Resource.String282</th>
            </tr>
        </thead>
        <tbody id="JX_tbody" style="width:100%;overflow:scroll">
        </tbody>
        <tfoot id="JX_tfoot" style="width:100%;overflow:scroll">
            <tr style="text-align-last:center;">
                <th scope="col"><input type="text" id="jx1" /></th>
                <th scope="col"><input type="text" id="jx2" /></th>
                <th scope="col"><input type="text" id="jx3" /></th>
                <th scope="col"><input type="number" id="jx4" /></th>
                <th scope="col"><input type="number" id="jx5" /></th>
                <th scope="col"><input type="number" id="jx6" /></th>
                <th scope="col"><input type="number" id="jx7" /></th>
                <th scope="col"><input type="number" id="jx8" /></th>
                <th scope="col"><input type="number" id="jx9" /></th>
                <th scope="col"><input type="number" id="jx10" /></th>
                <th scope="col"><input type="number" id="jx11" /></th>
                <th scope="col"><input type="number" id="jx12" /></th>
                <th scope="col" id="jix_tj">提交</th>
            </tr>
        </tfoot>
    </table>
    <div><button class="btn" id="jixing_tc">退出</button></div>
</div>
@*查看保存的供应商*@
<div class="CenterDiv2" style="text-align-last: center; display: none; border: 1px black solid; background-color: lightgray" id="div0">
    <table class="tab table ">
        <thead class="thead-light">
            <tr style="text-align-last:center;">
                <th scope="col">@Resource.String275</th>
                <th scope="col" id="Dan">@Resource.String276</th>
                <th scope="col">@Resource.String277</th>
                <th scope="col">@Resource.String278</th>
                <th scope="col">@Resource.String279</th>
                <th scope="col">@Resource.String280</th>
                <th scope="col">@Resource.String281</th>
                <th scope="col">@Resource.String502</th>
                <th scope="col">@Resource.String282</th>
            </tr>
        </thead>
        <tbody class="gun" id="BC_tbody" style="height:420px;">
        </tbody>
    </table>
    <div><button id="btn_bc_tc" class="btn">退出</button></div>
</div>

@*添加供应商部分*@
<div class="CenterDiv3" style="text-align-last: center; width: 70%;display: none;" id="div1">
    <form>
        <fieldset class="boun-C">
            <legend class="len01">@Resource.String283</legend>
            <div class="row">
                <div class="col-2 table_add_f" id="th" style="background-color:white;border:0.5px solid black;margin-left:15px;height:50px;line-height:50px;border-radius:5px 5px 0px 0px;background-color:white">基本信息</div>
                <div class="col-2 table_add_f" id="lc" style="background-color: white; border: 0.5px solid black; margin-left: 5px; height: 50px; line-height: 50px; border-radius: 5px 5px 0px 0px; background-color: lightgray">流程信息</div>
                <div class="col-2 table_add_f" id="tf" style="background-color: white; border: 0.5px solid black; margin-left: 5px; height: 50px; line-height: 50px; border-radius: 5px 5px 0px 0px; background-color: lightgray">体系信息</div>
                <div class="col-2 table_add_c" id="fj" style="background-color:white;border:0.5px solid black;margin-left:15px;height:50px;line-height:50px;border-radius:5px 5px 0px 0px;background-color:white;display:none">附件信息</div>
            </div>
            <div style="border-top:0.5px black solid" id="div1_2">
                <table id="table_add">
                    <thead style="display:block">
                        <tr>
                            <td><input type="radio" name="gys_zl" value="原材料供应商" />@Resource.String284</td>
                            <td><input type="radio" name="gys_zl" value="外购件供应商" />@Resource.String285</td>
                            <td><input type="radio" name="gys_zl" value="辅料供应商" />@Resource.String286</td>
                            <td><input type="radio" name="gys_zl" value="设备供应商" />@Resource.String287</td>
                        </tr>
                        <tr>
                            <td><span style="color:red">*</span>@Resource.String288</td>
                            <td><input type="text" id="gsy_mc" /></td>
                            <td><span>*</span>@Resource.String289</td>
                            <td><input type="text" id="gsy_bm" readonly /></td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String290</td>
                            <td><input type="text" id="gsy_wz" /></td>
                            <td><span>*</span>E_mail</td>
                            <td><input type="email" id="gsy_yx" /></td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String291</td>
                            <td><input type="text" id="gsy_dz" /></td>
                            <td><span style="color:red">*</span>注册资金</td>
                            <td><input type="text" id="gsy_zczj" /></td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String292</td>
                            <td>
                                <select id="gys_hangye">
                                    <option value="0">请选择</option>
                                    @foreach (var item in ViewBag.temp21 as List<buty3>)
                                    {
                                        <option value="@item.zl2_id">@item.zl2_name</option>
                                    }
                                </select>
                            </td>
                            <td>
                                <select id="gys_hangye2">
                                    <option value="0">--@Resource.String298--</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><span style="color:red">*</span> @Resource.String299</td>
                            <td colspan="3">
                                <span><input type="radio" name="gys_xz" value="外资" />@Resource.String300</span>
                                <span><input type="radio" name="gys_xz" value="合资" />@Resource.String301</span>
                                <span><input type="radio" name="gys_xz" value="民营" />@Resource.String302</span>
                                <span><input type="radio" name="gys_xz" value="国有" />@Resource.String303</span>
                                <span><input type="radio" name="gys_xz" value="股份制企业" />@Resource.String304</span>
                                <span><input type="radio" name="gys_xz" value="其他" />@Resource.String305</span>
                            </td>
                        </tr>
                        <tr>
                            <td><span style="color:red">*</span>@Resource.String306</td>
                            <td><input type="text" id="gsy_nsrdjh" /></td>
                            <td><span style="color:red">*</span>@Resource.String307</td>
                            <td><input type="text" id="gsy_fr" /></td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String308</td>
                            <td><input type="text" id="gsy_khyh" /></td>
                            <td><span>*</span>@Resource.String309</td>
                            <td><input type="number" id="gsy_yhzh" /></td>
                        </tr>

                        <tr>
                            <td><span>*</span>@Resource.String310</td>
                            <td><input type="text" id="gsy_dzfs" /></td>
                            <td><span>*</span>@Resource.String311</td>
                            <td><input type="text" id="gsy_fktj" /></td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String312</td>
                            <td>
                                <select id="gsy_jsfs">
                                    <option value="现金">@Resource.String313</option>
                                    <option value="转账">@Resource.String314</option>
                                    <option value="承兑">@Resource.String315</option>
                                    <option value="其他">@Resource.String316</option>
                                </select>
                            </td>
                            <td><span>*</span>@Resource.String317</td>
                            <td>
                                <select id="gsy_jsbz">
                                    <option value="人民币">@Resource.String318</option>
                                    <option value="美元">@Resource.String319</option>
                                    <option value="港币">@Resource.String320</option>
                                    <option value="欧元">@Resource.String321</option>
                                    <option value="比索">@Resource.String807</option>
                                    <option value="福林">@Resource.String808</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String322</td>
                            <td>
                                <select id="gsy_dhfs">
                                    <option value="海运">@Resource.String323</option>
                                    <option value="陆运">@Resource.String324</option>
                                    <option value="空运">@Resource.String325</option>
                                    <option value="货运">@Resource.String326</option>
                                    <option value="快递">@Resource.String327</option>
                                    <option value="其他">@Resource.String327</option>
                                </select>
                            </td>
                            <td><span>*</span>@Resource.String364</td>
                            <td>
                                <select id="gsy_dhdz">
                                    <option value="兰多本仓">@Resource.String328</option>
                                    <option value="外仓">@Resource.String329</option>
                                </select>
                            </td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String330</td>
                            <td><input type="text" id="gsy_cgy" /></td>
                            <td><span>*</span>@Resource.String331</td>
                            <td><input type="text" id="gsy_qd" /></td>
                        </tr>
                        <tr>
                            <td><span style="color:red">*</span>@Resource.String332</td>
                            <td><input type="text" id="gsy_lxr" /></td>
                            <td><span style="color:red">*</span>@Resource.String333</td>
                            <td><input type="text" id="gsy_lxfs" /></td>
                        </tr>
                        <tr>
                            <td><span>*</span>@Resource.String334</td>
                            <td><input type="text" id="gsy_gsdh" /></td>
                            <td><span style="color:red">*</span>申请原因</td>
                            <td><input type="text" id="gsy_lyqd" /></td>
                        </tr>
                    </thead>
                    <tbody style="display:none">
                        <tr>
                            <td>@Resource.String335</td>
                            <td><input type="text" id="gys_clsj" /></td>
                            <td>@Resource.String336</td>
                            <td><input type="number" id="gys_cfmj" />平方米</td>
                        </tr>
                        <tr>
                            <td>@Resource.String337</td>
                            <td>
                                <span><input type="radio" name="gys_gslb" value="定制加工" />@Resource.String338</span>
                                <span><input type="radio" name="gys_gslb" value="代理商" />@Resource.String339</span>
                                <span><input type="radio" name="gys_gslb" value="贸易商" />@Resource.String340</span>
                                <span><input type="radio" name="gys_gslb" value="服务商" />@Resource.String341</span>
                            </td>
                            <td>@Resource.String342</td>
                            <td><input type="number" id="gys_zrs" /></td>
                        </tr>
                        <tr>
                            <td>@Resource.String343</td>
                            <td></td>
                            <td></td>
                            <td></td>
                        </tr>
                        <tr>
                            <td></td>
                            <td id="gys_lly"></td>
                            <td><input type="number" id="gys_qn" /></td>
                            <td>@Resource.String344</td>
                        </tr>
                        <tr>
                            <td></td>
                            <td id="gys_ly"></td>
                            <td><input type="number" id="gys_zn" /></td>
                            <td>@Resource.String344</td>
                        </tr>
                        <tr>
                            <td></td>
                            <td id="gys_ty"></td>
                            <td><input type="number" id="gys_jn" /></td>
                            <td>@Resource.String344</td>
                        </tr>
                        <tr>
                            <td>@Resource.String345</td>
                            <td><input type="text" id="gys_cgsp" /></td>
                            <td>@Resource.String346</td>
                            <td><input type="text" id="gys_gykh" /></td>
                        </tr>
                        <tr>
                            <td>@Resource.String347</td>
                            <td colspan="3"><textarea id="gys_sqyy"></textarea></td>
                        </tr>
                        <tr>
                            <td>@Resource.String348</td>
                            <td colspan="3"><textarea id="gys_gysys" style="width:400px"></textarea></td>
                        </tr>
                    </tbody>
                    <tfoot style="display:none">
                        <tr id="gys_fl">
                            <td colspan="2">@Resource.String734</td>
                            <td><input type="checkbox" value="主要材料" />@Resource.String735</td>
                            <td><input type="checkbox" value="辅助材料" />@Resource.String736</td>
                            <td><input type="checkbox" value="办公及易耗品(不需要考核)" />@Resource.String737</td>
                            <td colspan="2"></td>
                        </tr>
                        <tr>
                            <td colspan="2">@Resource.String738</td>
                            <td colspan="5"><input type="text" id="gys_jyfw" /></td>
                        </tr>
                        <tr id="gys_tgrz">
                            <td colspan="2">@Resource.String758</td>
                            <td><input type="checkbox" value="IS09001" />IS09001</td>
                            <td><input type="checkbox" value="IS014001" />IS014001</td>
                            <td><input type="checkbox" value="OHSAS1800" />OHSAS1800</td>
                            <td><input type="checkbox" value="TS16949" />TS16949</td>
                            <td></td>
                        </tr>
                        <tr id="gys_jltx">
                            <td colspan="2">@Resource.String759</td>
                            <td><input type="radio" value="是" name="ra1" />@Resource.String739</td>
                            <td><input type="radio" value="否" name="ra1" />@Resource.String740</td>
                            <td colspan="3"></td>
                        </tr>
                        <tr id="gys_tgbg">
                            <td colspan="2">@Resource.String760</td>
                            <td><input type="checkbox" value="不能" />@Resource.String741</td>
                            <td><input type="checkbox" value="SGS" />SGS</td>
                            <td><input type="checkbox" value="MSDS" />MSDS</td>
                            <td><input type="checkbox" value="甲醛" />@Resource.String742</td>
                            <td><input type="checkbox" value="其他第三方报告" />@Resource.String743</td>
                        </tr>
                        <tr id="gys_wbxk">
                            <td colspan="2">@Resource.String744</td>
                            <td><input type="radio" value="是" name="ra2" />@Resource.String745</td>
                            <td><input type="radio" value="否" name="ra2" />@Resource.String746</td>
                            <td colspan="3"></td>
                        </tr>
                        <tr id="gys_jckq">
                            <td colspan="2">是否有进出口权</td>
                            <td><input type="radio" value="是" name="ra3" />@Resource.String745</td>
                            <td><input type="radio" value="否" name="ra3" />@Resource.String746</td>
                            <td colspan="3"></td>
                        </tr>
                        <tr id="gys_jg">
                            <td colspan="2">供方评鉴结果</td>
                            <td><input type="radio" value="合格(70分以上)" name="ra4" />@Resource.String747</td>
                            <td><input type="radio" value="不合格" name="ra4" />@Resource.String748</td>
                            <td colspan="3"></td>
                        </tr>
                        <tr id="gys_sx">
                            <td colspan="2">供应商属性</td>
                            <td><input type="checkbox" value="考核合格" />@Resource.String749</td>
                            <td><input type="checkbox" value="客户指定" />@Resource.String750</td>
                            <td><input type="checkbox" value="材料代理商" />@Resource.String751</td>
                            <td><input type="checkbox" value="第三方认证合格" />@Resource.String752</td>
                            <td></td>
                        </tr>

                        <tr id="gys_syzl">
                            <td colspan="2">供应商所有资料</td>
                            <td><input type="checkbox" value="供方评鉴表" />@Resource.String753</td>
                            <td><input type="checkbox" value="营业执照" />@Resource.String754</td>
                            <td><input type="checkbox" value="税务登记证" />@Resource.String755</td>
                            <td><input type="checkbox" value="体系证书" />@Resource.String756</td>
                            <td><input type="checkbox" value="许可证" />@Resource.String757</td>
                        </tr>

                    </tfoot>
                </table>
            </div>
            <div id="div1_1" style="display:none;height:300px;overflow:scroll">
                <table id="tab_zs" class="table tab">
                    <thead>
                        <tr>
                            <td colspan="6" class="tab_th">@Resource.String349</td>
                        </tr>
                        <tr>
                            <td>@Resource.String350</td>
                            <td>@Resource.String351</td>
                            <td>@Resource.String352</td>
                            <td>@Resource.String353</td>
                            <td>选择文件夹</td>
                            <td>@Resource.String354</td>
                        </tr>
                    </thead>
                    <tbody style="display:none">
                    </tbody>
                    <tfoot style="display:none">
                    </tfoot>
                </table>
                <table id="tab_zl" class="table tab">
                    <thead>
                        <tr>
                            <td colspan="6" class="tab_th">@Resource.String355</td>
                        </tr>
                        <tr>
                            <td>@Resource.String350</td>
                            <td>@Resource.String351</td>
                            <td>@Resource.String352</td>
                            <td>@Resource.String353</td>
                            <td>@Resource.String761</td>
                            <td>@Resource.String354</td>
                        </tr>
                    </thead>
                    <tbody style="display:none">
                    </tbody>
                    <tfoot style="display:none">

                    </tfoot>
                </table>
            </div>
            <input type="button" name="TUIchu" value="@Resource.String363" id="tui1" class="btn" />
            <input type="button" name="BaoCun" value="@Resource.String362" id="baoc1" class="btn" />
            <input type="button" name="Queding" value="@Resource.String361" id="que1" class="btn" />
        </fieldset>
    </form>
</div>
@*驳回记录*@
<div id="WT_dh_A" style="display: none; position: absolute; border: 1px black solid; left: 25%; top: 33%; background-color: white; background-color: #f1f1f1;width:400px;height:150px">
    <div style="text-align: right; background-color: #84acde;"><span class="WT_qxbh2" style=" margin: 20px;"><i class="bi bi-x-square"></i></span></div>
    <div id="WJ_ID" style="display:none"></div>
    <div class="row">
        <div class="col-4">@Resource.String201：</div>
        <div id="WT_dhr2" class="col-8"></div>
    </div>
    <p></p>
    <div class="row">
        <div class="col-4">@Resource.String202</div>
        <div class="col-8"><textarea class="col-12" id="WT_dhly2"></textarea></div>
    </div>
    <p></p>
    <div style="text-align:center">
        <button class="JIHNNM">@Resource.String203</button>
    </div>
</div>
<div style="display: flex; justify-content: space-between;">
    <span>共 @ViewBag.Yeshu 行</span>
    @using (Html.BeginForm("Cliview", "Application", FormMethod.Post))
    {<nav aria-label="Page navigation example" class="row" style="margin-right:50px;">
            <ul class="pagination">
            </ul>
            共<span id="komdr">@ViewBag.Shund</span>页
        </nav>
    }
</div>
<div style="display:none" id="por_id"></div>
@*批量添加模块*@

<div id="tinajia" class="YCFile">
    <div class="YANds"><span>@Resource.String108</span><span><i class="bi bi-x-circle" id="Quxiao"></i></span></div>
    <div class="SHnacs">
        <input type="file" value="" id="SHanngcF" accept="" />
        <input type="button" value="@Resource.String108" id="TIjaio" />
    </div>
</div>
@*erp返回的未计入系统的供应商*@
<div id="ERPyc" class="YCFile12">
    <div class="YANds Tuodong"><span>未计入系统的供应商</span><span><i class="bi bi-x-circle" onclick="$(this).parent().parent().parent().hide()"></i></span></div>
    <div>
        <table class="tab table ">
            <thead class="thead-light">
                <tr style="text-align-last:center;">
                    <th style="width:50px;"><input type="checkbox" name="name" value="" id="quanxuan" /></th>
                    <th>编码</th>
                    <th>供应商名称</th>
                    <th>供应商地址</th>
                    <th>供货品类1</th>
                    <th>供货品类1</th>
                </tr>
            </thead>
            <tbody class="gun" id="ERPGYS" style="height:400px;"></tbody>
        </table>
    </div>
    <div><input type="button" name="" value="提交" id="ERPti" /></div>
</div>
<div id="jsggfj" style="display:none"></div>
@section scripts{
    <script src="~/Scripts/jquery-3.4.1.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script>
        //页面加载
        $(function () {
            $("#li18").css({ "color": "black", "background-color": "white" })
            var number1=0
            $(document).on("click", ".tab_th", function (e) {
                getzhenshu()
                if (number1 == 0) {
                    $(e.target).parent().parent().siblings().css({ "display": "block" })
                    number1++
                }
                else {
                    $(e.target).parent().parent().siblings().css({ "display": "none" })
                    number1--
                }


            })
            $(document).on("click", "#gys_hangye", function (e) {
                changehang2($(e.target).val())
            })

            $(document).on("click", "#btn_bc_tc", function () {
                $("#div0").css({ "display": "none" })
            })
            $(document).on("click", "#gys_zr", function (e) {
                var prid = $(e.target).parent().parent().children().eq(1).text()
                $("#por_id").text(prid)
                getzhenshu(prid)
                $("#div1").show();
            })
            $(document).on("click", "#btn_chuan", function (e) {
                $("#tinajia").css({ "display": "block" })
            })
            //关闭文件上传
            $(document).on("click", "#Quxiao", function () {
                $("#tinajia").css({ "display": "none" })
            })
            //提交文件
            $("#TIjaio").click(function () {
                var fileUpload = $('#SHanngcF')[0];
                if (fileUpload.files.length > 0) {
                    var formData = new FormData();
                    formData.append('file', fileUpload.files[0]);
                    console.log(formData)
                    $.ajax({
                        url: '/Material/Gonpl',
                        type: 'POST',
                        data: formData,
                        processData: false,		//用于对data参数进行序列化处理 这里必须false
                        contentType: false,
                        success: function (fgggh) {
                            console.log(fgggh)
                            if (fgggh.length == 0) {
                                alert("该文件已打开，请关闭后重试！")
                            } else {
                                alert(fgggh)
                                $("#tinajia").hide()
                            }
                        },
                        error: function (xhr) {
                            alert("系统错误" + xhr);
                        }
                    })
                } else {
                    alert('请选择要上传的文件！');
                }
            })
            function changehang2(e) {
                var index = e
                console.log(index)
                if (index == "1") {
                    $("#gys_hangye2 option").remove()
                    $("gys_hangye2").append($(`<option value="null">--@Resource.String298--</option>`))
                    var $option = $(`
                            <option value="彩印纸箱">@Resource.String121</option>
                            <option value="水印纸箱">@Resource.String122</option>
                            `);
                    $("#gys_hangye2").append($option)
                }
                else if (index == "2") {
                    $("#gys_hangye2 option").remove()
                    $("gys_hangye2").append($(`<option value="null">--@Resource.String298--</option>`))
                    var $option = $(`
                            <option value="木箱">@Resource.String132</option>
                            <option value="木托盘">@Resource.String133</option>
                            `);
                    $("#gys_hangye2").append($option)
                }
                else if (index == "3") {
                    $("#gys_hangye2 option").remove()
                    $("gys_hangye2").append($(`<option value="null">--@Resource.String298--</option>`))
                    var $option = $(`
                            <option value="气泡袋">@Resource.String134</option>
                            <option value="气泡枕">@Resource.String135</option>
                            <option value="葫芦膜">@Resource.String136</option>
                            <option value="胶带">@Resource.String137</option>
                            <option value="缠绕膜">@Resource.String138</option>
                            <option value="塑料袋">@Resource.String139</option>
                            <option value="吸塑">@Resource.String140</option>
                            <option value="缓冲材">@Resource.String141</option>
                            `);
                    $("#gys_hangye2").append($option)
                }
                else if (index == "4") {
                    $("#gys_hangye2 option").remove()
                    $("gys_hangye2").append($(`<option value="null">--@Resource.String298--</option>`))
                    var $option = $(`option value="其他">其他</option>`);
                    $("#gys_hangye2").append($option)
                }
                else {
                    $("#gys_hangye2 option").remove()
                    var $option = $(`<option value="0">--@Resource.String298--</option>`);
                    $("#gys_hangye2").append($option)
                }
            }
            function getzhenshu(prid) {
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "stantes": 9, "id": prid },
                    success: function (date) {
                        createRow_zs(date)
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "stantes": 10, "id": prid },
                    success: function (date) {
                        createRow_zl(date)
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
            }
            function createRow_zl(date) {
                $("#tab_zl tbody tr").remove();
                $("#tab_zl tfoot tr").remove();
                var index = 1
                $.each(date, function (i, item) {
                    var temp = "已提交"
                    if (item.pf_wen == "") {
                        temp = "未提交"
                    }

                    var $tr = (`
                            <tr>
                                <td>${item.dt_id}</td>
                                <td>${item.dt_name}</td>
                                <td>${temp}</td>
                                <td><a>${item.pf_wen}<a></td>
                                <td><input type="file" id="ZL_WJ" style="width:100px"/></td>
                                <td><a id="zl_sc" href="#">@Resource.String356</a>|<a id="zl_schu" href="#">@Resource.String357</a></td>
                            </tr>
                        `);
                    if (item.dt_name != "其他") {
                        $("#tab_zl tbody").append($tr);
                    }
                    index++
                })
            }
            function createRow_zs(date) {
                $("#tab_zs tbody tr").remove();
                $("#tab_zs tfoot tr").remove();
                var index = 1
                $.each(date, function (i, item) {
                    var temp="已提交"
                    if (item.cer_wen == "") {
                        temp="未提交"
                    }

                    if (item.toc_name != "其他") {
                        var $tr = (`
                        <tr>
                            <td>${item.toc_id}</td>
                            <td>${item.toc_name}</td>
                            <td>${temp}</td>
                            <td><a>${item.cer_wen}<a></td>
                            <td><input type="file" id="ZS_WJ"  style="width:100px"/></td>
                            <td><a id="zs_sc" href="#" class="wj_sc">@Resource.String356</a>|<a id="zs_schu" href="#">@Resource.String357</a></td>
                        </tr>
                        `);
                        $("#tab_zs tbody").append($tr);
                    }
                    else {
                        var $tr =
                            $(`
                                <tr>
                                    <td style="width:122.78px">${item.toc_id}</td>
                                    <td style="width:122.78px">${item.toc_name}</td>
                                    <td style="width:122.78px">${temp}</td>
                                    <td style="width:122.78px"><a>${item.cer_wen}<a></td>
                                    <td style="width:122.78px"><input type="file" id="ZS_WJ"  style="width:100px"/></td>
                                    <td style="width:122.78px"><a id="zs_sc" href="#" class="wj_sc">@Resource.String356</a>|<a id="zs_schu" href="#">@Resource.String357</a></td>
                                </tr>
                            `);
                            $("#tab_zs tfoot").append($tr);
                    }
                    index++
                })
            }
            //提交证书
            $(document).on("click", "#zs_sc", function (e) {
                Upload_attachment($(e.target))
            })
            function Upload_attachment(e) {
                var temp = e.parent().parent().children().eq(0).text()
                var fileUpload = e.parent().prev().children().first()[0];
                if (fileUpload.files.length > 0) {
                    var fileData = new FormData();
                    fileData.append('file', fileUpload.files[0]);
                    console.log(fileData)
                    $.ajax({
                        url: '/Contracts/AddNdardo',
                        type: 'POST',
                        contentType: false, // 不设置内容类型
                        processData: false, // 不处理数据
                        data: fileData,
                        success: function (response) {
                            var BZJG = [];
                            BZJG.push({
                                cer_name: response,
                                por_id: $("por_id").text(),
                                toc_id: temp ,
                                cer_zhuang: "已提交",
                                cer_wen: response
                            })
                            $.ajax({
                                url: '/Material/addcer',
                                type: 'POST',
                                contentType: "application/json;charset=utf-8", // 不设置内容类型
                                dataType: "json",
                                processData: false, // 不处理数据
                                data: JSON.stringify(BZJG), fileData,
                                success: function (response) {

                                },
                                error: function (jqXHR, textStatus, errorMessage) {
                                    alert('AJAX请求失败1：' + errorMessage);
                                }
                            });
                        },
                        error: function (jqXHR, textStatus, errorMessage) {
                            alert('AJAX请求失败2：' + errorMessage);
                        }
                    });

                }
                else {
                    alert('请选择要上传的文件！');
                }
            }
            //提叫资料
            $(document).on("click", "#zl_sc", function (e) {
                Upload_attachment2($(e.target))
            })

            function Upload_attachment2(e) {
                var temp = e.parent().parent().children().eq(0).text()
                var fileUpload = e.parent().prev().children().first()[0];

                if (fileUpload.files.length > 0) {
                    var fileData = new FormData();
                    fileData.append('file', fileUpload.files[0]);
                    console.log(fileData)
                    $.ajax({
                        url: '/Contracts/AddNdardo',
                        type: 'POST',
                        contentType: false, // 不设置内容类型
                        processData: false, // 不处理数据
                        data: fileData,
                        success: function (response) {
                            var BZJG = [];
                            BZJG.push({
                                pf_name: response,
                                por_id: $("por_id").text(),
                                dt_id: temp,
                                pf_zhuang: "已提交",
                                pf_wen: response
                            })
                            console.log(BZJG)
                            $.ajax({
                                url: '/Material/addfile',
                                type: 'POST',
                                contentType: "application/json;charset=utf-8", // 不设置内容类型
                                dataType: "json",
                                processData: false, // 不处理数据
                                data: JSON.stringify(BZJG), fileData,
                                success: function (response) {
                                    alert("保存成功")
                                },
                                error: function (jqXHR, textStatus, errorMessage) {
                                    alert('AJAX请求失败1：' + errorMessage);
                                }
                            });
                        },
                        error: function (jqXHR, textStatus, errorMessage) {
                            alert('AJAX请求失败2：' + errorMessage);
                        }
                    });

                }
                else {
                    alert('请选择要上传的文件！');
                }

            }
            //获取当前年月日
            var now = new Date($.now());
            var year = (now.getFullYear()).toString();
            var month = (now.getMonth() + 1).toString();
            $("#gys_ty").text(year)
            $("#gys_ly").text(year*1-1)
            $("#gys_lly").text(year*1-2)
            $(document).on("click", ".table_add_f", function (e) {
                var index=0
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "stantes": 5, "namws": $("#gsy_bm").val() },
                    success: function (date) {
                        if (date == "1") {

                            index = 1
                            $("#jsggfj").text(index)
                        }
                        else {

                            index = 0
                            $("#jsggfj").text(index)
                        }
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
                var temp = $(e.target).text()
                if ($("#cs_sc_sx").text() == 0) {
                    var jfkisj = $("#jsggfj").text()
                    if (jfkisj == 1) {
                        $(e.target).css({ "background-color": "white" })
                        $(e.target).siblings().css({ "background-color": "#876541" })
                        if (temp == "基本信息") {
                            $("#table_add thead").css({ "display": "block" })
                            $("#table_add tbody").css({ "display": "none" })
                            $("#table_add tfoot").css({ "display": "none" })
                        }
                        else if (temp == "流程信息") {
                            $("#table_add thead").css({ "display": "none" })
                            $("#table_add tbody").css({ "display": "block" })
                            $("#table_add tfoot").css({ "display": "none" })
                        }
                        else {
                            $("#table_add thead").css({ "display": "none" })
                            $("#table_add tbody").css({ "display": "none" })
                            $("#table_add tfoot").css({ "display": "block" })
                        }
                    }
                    else {
                        if (temp != "基本信息") {
                            alert("请先保存")
                        }
                    }
                }
                else {
                    if (temp == "基本信息") {
                        $("#table_add thead").css({ "display": "block" })
                        $("#table_add tbody").css({ "display": "none" })
                        $("#table_add tfoot").css({ "display": "none" })
                    }
                    else if (temp == "流程信息") {
                        $("#table_add thead").css({ "display": "none" })
                        $("#table_add tbody").css({ "display": "block" })
                        $("#table_add tfoot").css({ "display": "none" })
                    }
                    else {
                        $("#table_add thead").css({ "display": "none" })
                        $("#table_add tbody").css({ "display": "none" })
                        $("#table_add tfoot").css({ "display": "block" })
                    }
                }
            })
            //点击添加事件--添加工艺
            $('input[name="tianjia"]').click(function () {
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: {"stantes": 13},
                    success: function (date) {
                        var temp=(date*1)+1
                        var afi = "GY" + "000" + temp;
                        if (date > 10) {
                            afi = "GY" + "00" + temp
                        }
                        if (date > 100) {
                            afi = "GY" + "0" + temp
                        }
                        if (date > 1000) {
                            afi = "GY" + temp
                        }
                        //写入随机申请单号
                        $("#gsy_bm").val(afi)
                        $("#div1").css({ "display": "block" });
                        $("#div1_1").css({ "display": "none" })
                        $("#div1_2").css({ "display": "block" })
                        $(".table_add_f").css({ "display": "block" })
                        $(".table_add_c").css({ "display": "none" })
                        $("#cs_sc_sx").text(0)
                    },
                    error: function (date) {
                        alert("错误 请重试！")
                    }
                })
            })
            //退出事件
            $("#tui1").click(function () {
                $("#div1").hide();
            })
            //---------------
            $("#ULen").addClass("Ulte");
            $("#ULen li").addClass("dui");
            $("#ULen li p").css({ "width": "120px" })
            $("#ULen li input,select").css("width", "188px");
        })

        $(function () {
            $(document).on("click", "#btn_bc", function () {
                $("#div0").css({ "display": "block" })
                getbaoc()
            })
            $(document).on("click", "#btn_ls", function () {
                $("#div0").css({ "display": "block" })
                getlings()
            })
            $(document).on("click", "#quanxuan", function () {
                if ($(this).prop("checked") == true) {
                    $(".Cbox").prop("checked", true)
                }
                else {
                    $(".Cbox").prop("checked", false)
                }
            })
            $(document).on("click", "#ERPti", function () {
                var CG_XX = [];
                var check = $("input[class=Cbox]:checked").parent().parent().length;
                if (check <= 0) {
                    alert("至少选中一行！");
                }
                else {
                    $("input[class=Cbox]:checked").parent().parent().each(function (index, obj) {
                        CG_XX.push({
                            PR_bian: $(obj).children().eq(1).text(),
                            PR_name: $(obj).children().eq(2).text(),
                            PR_di: $(obj).children().eq(3).text(),
                            PR_Lei1: $(obj).children().eq(4).children().val(),
                            PR_Lei2: $(obj).children().eq(5).children().val()
                        })
                    })
                    $.ajax({
                        url: '/Material/APrERp',
                        type: 'POST',
                        data: JSON.stringify(CG_XX),
                        contentType: "application/json;charset=utf-8",
                        dataType: "json",
                        success: function (date) {
                            alert(date);
                        },
                        error: function (date) {
                            alert(date);
                        }
                    })
                }
            })
            $(document).on("click", "#btn_ERP", function () {
                $.ajax({
                    url: '/Material/GYSerptonn',
                    type: 'POST',
                    data: { "state": 1 },
                    success: function (date) {
                        $("#ERPGYS tr").remove()
                        $.each(date, function (i, item) {
                            var $tr = $(`<tr><td style="width:50px;"><input type="checkbox" class="Cbox" /></td><td>${item.FNumber}</td><td>${item.FName}</td><td>${item.FAddress}</td>
                            <td><select style="width: -webkit-fill-available;"><option></option>@foreach (var item in ViewBag.Liao)
                            {
                                <option value="@item.zl_name">@item.zl_name</option>
                            }</select></td>
                            <td><select style="width: -webkit-fill-available;"><option></option>@foreach (var item in ViewBag.Liao)
                            {
                                <option value="@item.zl_name">@item.zl_name</option>
                            }</select></td></tr>`)
                            $("#ERPGYS").append($tr)
                        })
                        $("#ERPyc").show()
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
            })
            //分页
            $(document).ready(function () {
                var sjnd = "1"
                fenye(sjnd)
            })
            function fenye(a) {
                var hjin = a * 1
                var shunddd = $("#komdr").text() * 1
                $(".pagination li").remove()
                var $ul = ""
                $ul += (`<li class="page-item"><span class="page-link shiyong"><<<</span></li>`)
                for (var i = 1; i <= shunddd; i++) {
                    if (a < 4) {
                        if (i < 5) {
                            if (hjin == i) {
                                $ul += "<li class='page-item'><span class='page-link shiyong' id='shiyongll' style='background-color:#c4ded9'>" + i + "</span></li>";
                            } else {
                                $ul += "<li class='page-item'><span class='page-link shiyong'>" + i + "</span></li>";
                            }
                        } else {
                            $ul += "<li class='page-item'><span class='page-link'>.....</span></li>";
                            break
                        }
                    }
                    if (a >= 4) {
                        if (i < (hjin - 2)) {
                            continue
                        }
                        if (i > (hjin - 2) && i < (hjin + 2)) {
                            if (hjin == i) {
                                $ul += "<li class='page-item'><span class='page-link shiyong' id='shiyongll' style='background-color:#c4ded9'>" + i + "</span></li>";
                            } else {
                                $ul += "<li class='page-item'><span class='page-link shiyong'>" + i + "</span></li>";
                            }
                        } else {
                            $ul += "<li class='page-item'><span class='page-link'>.....</span></li>";
                        }
                        if (i >= (hjin + 2)) {
                            break
                        }
                    }

                }
                $ul += (`<li class="page-item"><span class="page-link shiyong">>>></span></li>`);
                $(".pagination").append($ul)
            }
            $(document).on("click", ".shiyong", function () {
                var shunddd = $("#komdr").text()
                var sjind = $(this).text()
                sjind = sjind == "<<<" ? "1" : sjind == ">>>" ? shunddd : sjind
                fenye(sjind)
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "stantes": 1, "shund": sjind-1, "shen": $("#shen").val(), "ming": $("#ming").val(), "shi": $("#shi").val() },
                    success: function (date) {
                        createRow(date);
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
            })

            function createRow(date) {
                $("#BUtain tr").remove();
                var sjinf = $("#shiyongll").text() * 1 - 1
                var indec = sjinf*10+1
                $.each(date, function (i, item) {
                    var $tr = (` <tr>
                                    <td style="width:50px">${indec}</td>
                                    <td style="display:none">${item.PR_ID}</td>
                                    <td style="width:100px;text-align:right">${item.PR_bian}</td>
                                    <td style="width:300px">${item.PR_name}</td>
                                    <td>${item.PR_di}</td>
                                    <td>${item.PR_lian}</td>
                                    <td>${item.PR_you}</td>
                                    <td>${item.PR_bei}</td>
                                    <td>${item.PR_Lei1}</td>
                                    <td>${item.PR_Lei2}</td>
                                    <td><span id="gys_zr"><a>@Resource.String360</a></span></td>
<td><span id="gys_jx">机械数据</span></td>
<td><span id="Xiu_cli" class="DEL_c DEL_c_Y">@Resource.String358</span>|<span id="Del_Cli" class="DEL_c DEL_c_D">@Resource.String359</span></td>
                                </tr>
                                        `);
                    $("#BUtain").append($tr);
                    indec ++
                })
            }
            $(document).on("click", "#gys_jx", function (e) {
                id = $(e.target).parent().parent().children().eq(1).text()
                $("#por_id").text(id)
                $("#div3").css({"display":"block"})
                getjix(id)
            })

            $(document).on("click", "#jixing_tc", function () {
                $("#div3").css({ "display": "none" })
            })
            function getjix() {
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "stantes": 14, "id": $("#por_id").text()},
                    success: function (date) {
                        createRow_jixing(date);
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
            }
            function createRow_jixing(date) {
                $("#JX_tbody tr").remove();
                var indec=1
                $.each(date, function (i, item) {
                    var $tr = (`
                                        <tr style="text-align-last:center;">
                                            <th scope="col" style="dispaly:none">${item.sb_id}</th>
                                            <th scope="col">${item.sb_name}</th>
                                            <th scope="col">${item.sb_pingpai}</th>
                                            <th scope="col">${item.sb_gongxu}</th>
                                            <th scope="col">${item.sb_zuida}</th>
                                            <th scope="col">${item.sb_zuixiao}</th>
                                            <th scope="col">${item.sb_channeng}</th>
                                            <th scope="col">${item.sb_renli}</th>
                                            <th scope="col">${item.sb_zuiho}</th>
                                            <th scope="col">${item.sb_zuibiao}</th>
                                            <th scope="col">${item.sb_kaicao_x}</th>
                                            <th scope="col">${item.sb_kaicao_d}</th>
                                            <th scope="col">${item.sb_yingshua_d}</th>
                                            <td><span id="jixing_sc" class="DEL_c DEL_c_D">删除</span></td>
                                        </tr>
                                        `);
                    $("#JX_tbody").append($tr);
                    indec++
                })
            }
            $(document).on("click", "#jix_tj", function () {
                var da = []
                da.push({
                    sb_name: $("#jx1").val(),
                    sb_pingpai: $("#jx2").val(),
                    sb_gongxu: $("#jx3").val(),
                    sb_zuida: $("#jx4").val(),
                    sb_zuixiao: $("#jx5").val(),
                    sb_channeng: $("#jx6").val(),
                    sb_renli: $("#jx7").val(),
                    sb_zuiho: $("#jx8").val(),
                    sb_zuibiao: $("#jx9").val(),
                    sb_kaicao_x: $("#jx10").val(),
                    sb_kaicao_d: $("#jx11").val(),
                    sb_yingshua_d: $("#jx12").val(),
                    gys_id: $("#por_id").text()
                })
                console.log(da)
                $.ajax({
                    url: "/Material/addjinx",
                    type: "POST",
                    data: JSON.stringify(da),
                    contentType: "application/json;charset=utf-8",
                    dataType: "json",
                    success: function (text) {
                        alert(text)
                        getjix()
                        $("#JX_tfoot tr th input").val("")
                    },
                    error: function (text) {
                        alert("添加错误");
                    }
                })
            })
            $(document).on("click", "#jixing_sc", function (e) {
                var prid= $("#por_id").text()
                var id = $(e.target).parent().parent().children().eq(0).text()
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "stantes": 1, "id": id },
                    success: function (date) {
                        getjix(prid);
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
            })
            $(document).on("click", "#gys_pj", function (e) {
                var zhuang = $(e.target).parent().parent().children().eq(7).text()
                console.log(zhuang)
                if (zhuang == "准入 ") {

                    alert("该供应商已是合格供应商")
                }
                else{
                    var bian = $(e.target).parent().parent().children().eq(2).text()
                    console.log(bian)
                    window.location.href = "/ShenPI/Gys_Pj?bian=" + bian;

                }
            })
            $(document).on("click", "#gys_zr", function (e) {
                id = $(e.target).parent().parent().children().eq(1).text()
                $("#div1").css({"display":"block"});
                $("#div1_1").css({ "display": "block" })
                $("#div1_2").css({ "display": "none" })
                $(".table_add_f").css({ "display": "none" })
                $(".table_add_c").css({ "display": "block" })


            })
            //查看
            //$('input[name="cha"]').click(function () {
            //    var shen = $("#shen").val()
            //    var shi = $("#shi").val()
            //    var ming = $("#ming").val()
            //    $.ajax({
            //        url: '/Material/AddGS',
            //        type: 'POST',
            //        data: { "PR_name": shen, "PR_di": ming, "PR_lian": shi, "stantes": 2 },
            //        success: function (date) {
            //            createRow(date);
            //            fenye("1")
            //        },
            //        error: function (date) {
            //            alert("错误 请重试！")
            //        }
            //    })
            //})

            //保存添加
            $("#que1").click(function (e) {
                addpro($(e.target))
            })
            $(document).on("click", "#baoc1", function (e) {
                addpro($(e.target))
            })

            function addpro(e) {
                var zhuang =""
                if (e.val() == "保存") {
                    zhuang = "保存"
                }
                //else {
                //    zhuang="临时"
                //}
                var da = []
                da.push({
                    PR_bian: $("#gsy_bm").val(),
                    PR_name: $("#gsy_mc").val(),
                    PR_di: $("#gsy_dz").val(),
                    PR_you: $("#gsy_yx").val(),
                    PR_lian: $("#gsy_gsdh").val(),
                    PR_nsrjdh: $("#gsy_nsrdjh").val(),
                    PR_yhzh: $("#gsy_yhzh").val(),
                    PR_gswz: $("#gsy_wz").val(),
                    PR_dzfs: $("#gsy_dzfs").val(),
                    PR_fktj: $("#gsy_fktj").val(),
                    PR_dhfs: $("#gsy_dhfs").val(),
                    PR_cgy: $("#gsy_cgy").val(),
                    PR_qyxz: $("input[name=gys_xz]:checked").val(),
                    PR_khyh: $("#gsy_khyh").val(),
                    PR_fr: $("#gsy_fr").val(),
                    PR_lxr: $("#gsy_lxr").val(),
                    PR_jsfs: $("#gsy_jsfs").val(),
                    PR_jsbz: $("#gsy_jsbz").val(),
                    PR_dhdz: $("#gsy_dhdz").val(),
                    PR_qd: $("#gsy_qd").val(),
                    PR_zl: $("input[name=gys_zl]:checked").val(),
                    PR_bei: zhuang,
                    PR_lyqd: $("#gsy_lyqd").val(),
                    PR_jer: $("#gsy_zczj").val(),
                    PR_Lei1: $("#gys_hangye").val(),
                    PR_Lei2: $("#gys_hangye2").val(),
                    PR_LIDH: $("#gsy_lxfs").val()
                })
                console.log(da)
                if (zhuang == "保存") {
                    var index=0
                    if ($("#gsy_mc").val() == null || $("#gsy_mc").val() == "") {
                        $("#gsy_mc").css({ "border": "solid 1px red" })
                        index++
                    }
                    else {
                        $("#gsy_mc").css({ "border": "solid 0.5px black" })
                    }
                    if ($("#gsy_lxr").val() == null || $("#gsy_lxr").val() == "") {
                        $("#gsy_lxr").css({ "border": "solid 1px red" })
                        index++
                    }
                    else {
                        $("#gsy_lxr").css({ "border": "solid 0.5px black" })
                    }
                    if ($("#gsy_lxfs").val() == null || $("#gsy_lxfs").val() == "") {
                        $("#gsy_lxfs").css({ "border": "solid 1px red" })
                        index++
                    }
                    else {
                        $("#gsy_lxfs").css({ "border": "solid 0.5px black" })
                    }
                    if ($("#gsy_lyqd").val() == null || $("#gsy_lyqd").val() == "") {
                        $("#gsy_lyqd").css({ "border": "solid 1px red" })
                        index++
                    }
                    else {
                        $("#gsy_lyqd").css({ "border": "solid 0.5px black" })
                    }
                    if ($("#gsy_dz").val() == null || $("#gsy_dz").val() == "") {
                        $("#gsy_dz").css({ "border": "solid 1px red" })
                        index++
                    }
                    else {
                        $("#gsy_dz").css({ "border": "solid 0.5px black" })
                    }
                    if ($("#gsy_nsrdjh").val() == null || $("#gsy_nsrdjh").val() == "") {
                        $("#gsy_nsrdjh").css({ "border": "solid 1px red" })
                        index++
                    }
                    else {
                        $("#gsy_nsrdjh").css({ "border": "solid 0.5px black" })
                    }
                    if ($("#gsy_fr").val() == null || $("#gsy_fr").val() == "") {
                        $("#gsy_fr").css({ "border": "solid 1px red" })
                        index++
                    }
                    else {
                        $("#gsy_fr").css({ "border": "solid 0.5px black" })
                    }
                    if ($("#gsy_cgy").val() == null || $("#gsy_cgy").val() == "") {
                        $("#gsy_cgy").css({ "border": "solid 1px red" })
                        index++
                    }
                    else {
                        $("#gsy_cgy").css({ "border": "solid 0.5px black" })
                    }
                    if ($("input[name=gys_xz]:checked").length < 0) {
                        $("input[name=gys_xz]").parent().css({ "border": "solid 1px red" })
                        index++
                    } else {
                        $("#gsy_cgy").css({ "border": "solid 0.5px black" })
                    }
                    if (index == 0) {
                        $.ajax({
                            url: "/Material/addgongys",
                            type: "POST",
                            data: JSON.stringify(da),
                            contentType: "application/json;charset=utf-8",
                            dataType: "json",
                            success: function (text) {
                                if (e.val() == "保存") {
                                    alert("保存成功,点击提交进入审核！")
                                }
                                else {
                                    alert("提交成功")
                                }
                                addfol()
                                addsys()
                            },
                            error: function (text) {
                                alert("基础信息添加错误" + 0);
                            }
                        })
                    }
                    else {
                        alert("红框为必填项")
                    }

                }
                else {
                    //$.ajax({
                    //    url: "/Material/addgongys",
                    //    type: "POST",
                    //    data: JSON.stringify(da),
                    //    contentType: "application/json;charset=utf-8",
                    //    dataType: "json",
                    //    success: function (text) {
                    //        if (e.val() == "保存") {
                    //            alert("保存成功")
                    //        }
                    //        else {
                    //            alert("提交成功")
                    //        }
                    //        addfol()
                    //        addsys()
                    //    },
                    //    error: function (text) {
                    //        alert("基础信息添加错误" + 0);
                    //    }
                    //})
                    $.ajax({
                        url: '/Material/AddGS',
                        type: 'POST',
                        data: { "stantes": 17, "namws": $("#gsy_bm").val() },
                        success: function (date) {
                            if (date == "Y") {
                                var sjinfPLM = ""
                                var FJIDNS = {
                                    "FFirst": "采购主管",//一级审批人
                                    "FFZ": "审批中",//状态
                                    "FFS": "",
                                    "FTwo": "业务发展部经理",//二级审批人
                                    "FTZ": "审批中",//状态
                                    "FFIZ": "",
                                    "FBzt": "",//备注
                                    "FJINF": $("#gsy_bm").val(),
                                    "FShenR": $("#Login_N").text(),
                                    "FSHENP": "2",
                                    "FMIao": "供应商审核",
                                    "Fzhuang": "审核中"
                                }
                                if (FJIDNS.FFirst != "" || FJIDNS.FTwo != "") {
                                    $.ajax({
                                        url: "/Procure/HeaApplication",
                                        type: 'POST',
                                        data: FJIDNS,
                                        success: function (text) {
                                            alert(text)
                                        },
                                        error: function (text) {
                                            alert("系统错误" + text);
                                        }
                                    })
                                }
                            } else {
                                alert("请先保存供应商！")
                            }
                        },
                        error: function (date) {
                            alert(date);
                        }
                    })

                }
            }
            function getlings() {
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "stantes": 16 },
                    success: function (date) {
                        createRow__3(date);
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
            }
            $(document).on("change", "#gys_hangye", function (e) {
                var id = $(e.target).val()
                $.ajax({
                    url: '/Admin/Purchasing_Authority',
                    type: 'GET',
                    data: { "id": id, "state": 4 },
                    success: function (data) {
                        $("#gys_hangye2 option").remove()
                        $.each(data, function (i, item) {
                            $("#gys_hangye2").append($(`<option value="${item.zl_name}">${item.zl_name}</option>`))
                        })
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            })
            function createRow__3(date) {
            $("#BC_tbody tr").remove();
             var indec = 1
            $.each(date, function (i, item) {
            var $tr = (`
                    <tr>
                        <td>${indec}</td>
                        <td style="display:none">${item.PR_ID}</td>
                        <td>${item.PR_bian}</td>
                        <td>${item.PR_name}</td>
                        <td>${item.PR_di}</td>
                        <td>${item.PR_lian}</td>
                        <td>${item.PR_you}</td>
                        <td>${item.PR_bei} </td>
                        <td><a href="#" id="gys_pj">供应商评价</a></td>
                    </tr>`);
                $("#BC_tbody").append($tr);
                indec++;
            })
        }

            function getbaoc() {
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "stantes": 12 },
                    success: function (date) {
                        createRow__2(date);
                    },
                    error: function (date) {
                        alert(date);
                    }
                })
            }
            function createRow__2(date) {
                $("#BC_tbody tr").remove();
                 var indec = 1
                $.each(date, function (i, item) {
                var $tr = (`
                        <tr>
                            <td>${indec}</td>
                            <td style="display:none">${item.PR_ID}</td>
                            <td>${item.PR_bian}</td>
                            <td>${item.PR_name}</td>
                            <td>${item.PR_di}</td>
                            <td>${item.PR_lian}</td>
                            <td>${item.PR_you}</td>
                            <td>${item.PR_bei} </td>
                            <td style="color:red" class="BOhuijl">驳回理由</td>
                            <td><span id="Xiu_cli" class="DEL_c DEL_c_Y">@Resource.String358</span>|<span id="Del_Cli" class="DEL_c DEL_c_D">@Resource.String359</span></td>
                        </tr>`);
                    $("#BC_tbody").append($tr);
                    indec++;
                })
            }
            function addxx() {
                var index = $("#gsy_bm").val()
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'GET',
                    data: { "namws": index, "stantes": 4 },
                    success: function (date) {
                        console.log(date)
                        var da = []
                        da.push({
                        })
                        console.log(da)
                        $.ajax({
                            url: "/Material/addlxx",
                            type: "POST",
                            data: JSON.stringify(da),
                            contentType: "application/json;charset=utf-8",
                            dataType: "json",
                            success: function (text) {

                            },
                            error: function (text) {
                                alert("系统错误" + text);
                            }
                        })
                    },
                    error: function () {
                        alert("错误！")
                    }
                })
            }
            function addfol() {
                var index = $("#gsy_bm").val()
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'GET',
                    data: { "namws": index, "stantes": 4 },
                    success: function (date) {
                        console.log(date)
                        var da = []
                        da.push({
                            fl_clsj: $("#gys_clsj").val(),
                            fl_gslb: $("input[name=gys_gslb]:checked").val(),
                            fl_cgsp: $("#gys_cgsp").val(),
                            fl_sqyy: $("#gys_sqyy").val(),
                            fl_ys: $("#gys_gysys").val(),
                            fl_cfmj: $("#gys_cfmj").val(),
                            fl_zrs: $("#gsy_zrs").val(),
                            fl_gykh: $("#gys_gykh").val(),
                            pr_id: date,
                            fl_turnover1: $("#gys_jn").val(),
                            fl_turnover2: $("#gys_zn").val(),
                            fl_turnover3: $("#gys_qn").val(),
                        })
                        console.log(da)
                        $.ajax({
                            url: "/Material/addliuc",
                            type: "POST",
                            data: JSON.stringify(da),
                            contentType: "application/json;charset=utf-8",
                            dataType: "json",
                            success: function (text) {
                            },
                            error: function (text) {
                                alert("流程添加错误" + 1);
                            }
                        })
                    },
                    error: function () {
                        alert("错误！")
                    }
                })
            }
            function addsys() {
                var index = $("#gsy_bm").val()
                var temp1=""
                var temp2=""
                var temp3=""
                var temp4=""
                var temp5=""
                $("#gys_fl td input[type=checkbox]:checked").each(function (i, item) {
                    temp1 += $(item).val()+" "
                })
                $("#gys_tgrz td input[type=checkbox]:checked").each(function (i, item) {
                    temp2 += $(item).val()+" "
                })
                $("#gys_tgbg td input[type=checkbox]:checked").each(function (i, item) {
                    temp3 += $(item).val()+" "
                })
                $("#gys_sx td input[type=checkbox]:checked").each(function (i, item) {
                    temp4 += $(item).val()+" "
                })
                $("#gys_syzl td input[type=checkbox]:checked").each(function (i, item) {
                    temp5 += $(item).val()+" "
                })
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'GET',
                    data: { "namws": index, "stantes": 4 },
                    success: function (date) {
                        console.log(date)
                        var da = []
                        da.push({
                            sys_fl: temp1,
                            sys_fw: $("#gys_jyfw").val(),
                            sys_tgbg: temp3,
                            sys_tgrz: temp2,
                            sys_jltx: $("input[name=ra1]:checked").val(),
                            sys_wbxk: $("input[name=ra2]:checked").val(),
                            sys_jckq: $("input[name=ra3]:checked").val(),
                            sys_pjjg: $("input[name=ra4]:checked").val(),
                            sys_sx: temp4,
                            sys_syzl: temp5,
                            pro_id: date
                        })
                        console.log(da)
                        $.ajax({
                            url: "/Material/addsys",
                            type: "POST",
                            data: JSON.stringify(da),
                            contentType: "application/json;charset=utf-8",
                            dataType: "json",
                            success: function (text) {
                            },
                            error: function (text) {
                                alert("体系添加错误" + 2);
                            }
                        })
                    },
                    error: function () {
                        alert("错误！")
                    }
                })
            }
        })

        $(function () {
            $(document).on("click", "#Xiu_cli", function (e) {
                var bian = $(e.target).parent().parent().children().eq(2).text()
                $("#cs_sc_sx").text(1)
                $("#div1").css({ "display": "block" });
                $("#div1_1").css({ "display": "none" })
                $("#div1_2").css({ "display": "block" })
                $(".table_add_f").css({ "display": "block" })
                $(".table_add_c").css({ "display": "none" })
                console.log(bian)
                findprov(bian)
                getflow(bian)
            })
            function findprov(e) {
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "namws": e, "stantes": 3 },
                    success: function (path) {
                        console.log(path)
                        $.each(path, function (i, item) {
                            $("#gsy_bm").val(item.PR_bian)
                            $("#gsy_mc").val(item.PR_name)
                            $("#gsy_dz").val(item.PR_di)
                            $("#gsy_yx").val(item.PR_you)
                            $("#gsy_gsdh").val(item.PR_lian)
                            $("#gsy_nsrdjh").val(item.PR_nsrjdh)
                            $("#gsy_yhzh").val(item.PR_yhzh)
                            $("#gsy_wz").val(item.PR_gswz)
                            $("#gsy_dzfs").val(item.PR_dzfs)
                            $("#gsy_fktj").val(item.PR_fktj)
                            $("#gsy_dhfs").val(item.PR_dhfs)
                            $("#gsy_cgy").val(item.PR_cgy)
                            $("#gsy_khyh").val(item.PR_khyh)
                            $("#gsy_fr").val(item.PR_fr)
                            $("#gsy_lxr").val(item.PR_lxr)
                            $("#gsy_jsfs").val(item.PR_jsfs)
                            $("#gsy_jsbz").val(item.PR_jsbz)
                            $("#gsy_dhdz").val(item.PR_dhdz)
                            $("#gsy_qd").val(item.PR_qd)
                            $("#gsy_lyqd").val(item.PR_lyqd)
                            $("#gsy_zczj").val(item.PR_jer)
                            $("#gsy_lxfs").val(item.PR_LIDH)
                            $("input[name=gys_zl]").each(function (i, obj) {
                                if ($(obj).val() == item.PR_zl) {
                                    $(obj).prop("checked", true)
                                }
                            })
                            $("input[name=gys_xz]").each(function (i, temp) {
                                if ($(temp).val() == item.PR_qyxz) {
                                    $(temp).prop("checked", true)
                                }
                            })
                            $("#gys_hangye").val(item.PR_Lei1)
                            $.ajax({
                                url: '/Admin/Purchasing_Authority',
                                type: 'GET',
                                data: { "id": item.PR_Lei1, "state": 4 },
                                success: function (data) {
                                    $("#gys_hangye2 option").remove()
                                    $.each(data, function (i, item) {
                                        $("#gys_hangye2").append($(`<option value="${item.zl_name}">${item.zl_name}</option>`))
                                    })
                                    $("#gys_hangye2").val(item.PR_Lei2)
                                },
                                error: function () {
                                    alert('Request Error');
                                }
                            })
                            id = item.PR_ID
                        })
                        console.log(id)
                        getflow(id)
                        getsys(id)
                    },
                    error: function () {
                        alert("系统错误!");
                    }
                })
            }
            function getflow(e) {
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "id": e, "stantes": 8 },
                    success: function (path) {
                        $.each(path, function (i, item) {
                            $("#gys_clsj").val(item.fl_clsj)
                            $("#gys_cgsp").val(item.fl_sqyy)
                            $("#gys_sqyy").val(item.fl_sqyy)
                            $("#gys_gysys").val(item.fl_ys)
                            $("#gys_cfmj").val(item.fl_cfmj)
                            $("#gsy_zrs").val(item.fl_zrs)
                            $("#gys_gykh").val(item.fl_gykh)
                            $("#gys_jn").val(item.fl_turnover1)
                            $("#gys_zn").val(item.fl_turnover2)
                            $("#gys_qn").val(item.fl_turnover3)
                            $("input[name=gys_gslb]").each(function (i, obj) {
                                if ($(obj).val() == item.fl_gslb) {
                                    $(obj).prop("checked", true)
                                }
                            })
                        })
                    },
                    error: function () {
                        alert("系统错误!");
                    }
                })
            }
            function getsys(e) {
                $.ajax({
                    url: '/Material/AddGS',
                    type: 'POST',
                    data: { "id": e, "stantes": 11 },
                    success: function (path) {
                        $.each(path, function (i, item) {
                            $("input[name=ra1]").each(function (i, obj1) {
                                if (item.sys_jltx == $(obj1).val()) {
                                    $(obj1).prop("checked", true)
                                }
                            })
                            $("input[name=ra2]").each(function (i, obj2) {
                                if (item.sys_wbxk == $(obj2).val()) {
                                    $(obj2).prop("checked", true)
                                }
                            })
                            $("input[name=ra3]").each(function (i, obj3) {
                                if (item.sys_jckq == $(obj3).val()) {
                                    $(obj3).prop("checked", true)
                                }
                            })
                            $("input[name=ra4]").each(function (i, obj4) {
                                if (item.sys_pjjg == $(obj4).val()) {
                                    $(obj4).prop("checked", true)
                                }
                            })
                            $("#gys_jyfw").val(item.sys_fw)
                            var temp1 = item.sys_fl == null?"": item.sys_fl.split(" ")
                            var temp2 = item.sys_syzl == null ? "" : item.sys_syzl.split(" ")
                            var temp3 = item.sys_tgbg == null ? "" : item.sys_tgbg.split(" ")
                            var temp4 = item.sys_tgrz == null ? "" : item.sys_tgrz.split(" ")
                            var temp5 = item.sys_sx == null ? "" : item.sys_sx.split(" ")

                            $.each(temp1, function (i, num1) {
                                $("#gys_fl td input[type=checkbox]").each(function (i, index1) {
                                    if ($(index1).val() == num1) {
                                        $(index1).prop("checked", true)
                                    }
                                })
                            })
                            $.each(temp2, function (i, num2) {
                                $("#gys_syzl td input[type=checkbox]").each(function (i, index2) {
                                    if ($(index2).val() == num2) {
                                        $(index2).prop("checked", true)
                                    }
                                })
                            })
                            $.each(temp3, function (i, num3) {
                                $("#gys_tgbg td input[type=checkbox]").each(function (i, index3) {
                                    if ($(index3).val() == num3) {
                                        $(index3).prop("checked", true)
                                    }
                                })
                            })
                            $.each(temp4, function (i, num4) {
                                $("#gys_tgrz td input[type=checkbox]").each(function (i, index4) {
                                    if ($(index4).val() == num4) {
                                        $(index4).prop("checked", true)
                                    }
                                })
                            })
                            $.each(temp5, function (i, num5) {
                                $("#gys_sx td input[type=checkbox]").each(function (i, index5) {
                                    if ($(index5).val() == num5) {
                                        $(index5).prop("checked", true)
                                    }
                                })
                            })

                        })
                    },
                    error: function () {
                        alert("系统错误!");
                    }
                })
            }
            $(document).on("click", "#Del_Cli", function () {
                if (confirm("是否删除该行！")) {
                    var CL_id = $(this).parent().parent().children().first().next().text()//CL_ID
                    console.log(CL_id)
                    $.ajax({
                        url: '/Material/AddGS',
                        type: 'POST',
                        data: { "namws": CL_id, "stantes": 7 },
                        success: function (path) {
                            location.reload(true);
                            alert(path)
                        },
                        error: function () {
                            alert("系统错误!");
                        }
                    })
                }
            })
            $(document).on("click", ".BOhuijl", function (e) {
                //驳回理由
                var bian = $(this).parent().children().eq(1).text();
                $.ajax({
                    url: '/Procure/Price_main',
                    type: 'GET',
                    data: { "CG_INFSQD": bian, "state": 14 },
                    success: function (KKMJ) {
                        if (KKMJ == "") {
                            alert("无驳回记录！")
                            return
                        }
                        $("#WT_dh_A").show()
                        var shn = KKMJ.split(':')
                        console.log(shn)
                        $("#WT_dhly2").val(shn[0])
                        $("#WT_dhr2").text(shn[1])
                    },
                    error: function () {
                        alert('Request Error');
                    }
                })
            })
            $(document).on("click", ".JIHNNM", function () {
                $("#WT_dh_A").hide()
            })

        })
    </script>
}

